//
//@File    :	7.9_strgfun.cpp
//@Time    :	2021/08/14 11:49:22
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	functions with a string argument
//

#include <iostream>

using namespace std;
unsigned int c_in_str(const char * str,char ch);
int main()
{
    char mmm[15] = "minimum";
    char *wail = (char*)"ululate";

    unsigned int ms=c_in_str(mmm,'m');
    unsigned int us=c_in_str(wail,'u');
    cout<<ms<<" m characters in "<<mmm<<endl;
    cout<<us<<" u cgaracters in "<<wail<<endl;
    system("pause");
    return 0;
}
unsigned int c_in_str(const char * str,char ch)
{
    unsigned int count=0;
    //处理字符串的标准方式
    while (*str)//只要*str 不为'\0'空字符
    {
        if (*str==ch)
        {
            count++;
        }
        str++;
    }
     return count;
}